package com.roselism.mobilesafe.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.TextView;

import com.roselism.mobilesafe.R;
import com.roselism.mobilesafe.adapter.GridHomeAdapter;
import com.roselism.mobilesafe.library.MarqueeTextView;

import butterknife.Bind;
import butterknife.ButterKnife;

public class HomeActivity extends AppCompatActivity {

    @Bind(R.id.title) TextView title;
    @Bind(R.id.marquee) MarqueeTextView mMarquee;
    @Bind(R.id.gridview) GridView mGridview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        initView();
        initEvent();
        initData();
    }

    void initView() {
        setContentView(R.layout.activity_home);
        ButterKnife.bind(this);
        mGridview.setAdapter(new GridHomeAdapter(this));
    }

    void initEvent() {
        mGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (position == 8) { // setting 页面
                    startActivity(new Intent(HomeActivity.this, SettingActivity.class)); // 跳转到setting界面
                }
            }
        });
    }


    void initData() {

    }
}